rm(list=ls())

#install.packages("rddtools")
#install.packages("rdrobust")

library(foreign)
library(ggplot2)

setwd("")

############################## Age Gap Turnout--TFA Paper ############################## 
priority<-read.csv("Age Gaps in CSES.csv")

attach(priority) 

color.names<-c("blue", "grey68")

plot1<-ggplot(priority, aes(y=age_gap_100, reorder(country, num))) + 
  geom_bar(stat="identity", aes(fill = factor(us)), width=0.5) +
  theme_bw() + theme(panel.grid.major = element_blank(), 
                     panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) +
  labs(x="Countries in the CSES", y="Difference in Turnout Between 60+ and < 30 Voters", title="") +
  scale_fill_manual(values=color.names) +
  theme(axis.text.x = element_text(angle=90)) +
  scale_y_continuous(limits=c(-10, 40)) +
  theme(legend.position="none", legend.key=element_blank())   + theme(text = element_text(size=42)) 

plot1
ggsave(plot1, file="inequality_young_cses_tfa.pdf", width=12, height=8.5, scale=2)



